home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / VideoToolboxSources / SetMouse.c < prev    next >
Text File  |  1995-10-06  |  2KB  |  58 lines

  1. /*
  2. SetMouse.c
  3.  
  4. Sets the mouse location to the given point, which is specified in the local
  5. coordinate system of the current port.
  6.  
  7. WARNING: In the Q & A Stack, Apple tells you how to do this, but warns that the
  8. technique uses undocumented low-memory locations that are considered unsupported
  9. and volatile and may change in future CPUs.
  10.  
  11. WARNING: According to a note from Apple, this may not work on certain 680x0 Macs,
  12. e.g. the Centris. (I don't know whether it works on PowerMacs; I would guess that it
  13. does work.) Apple has issued preliminary documentation of a Cursor Device Manager
  14. that eventually will support all Macs. See MoveMouse.c in VideoToolboxSources.
  15.  
  16. From "Code gadgets: Setting the mouse location", THINKin' CaP, 1(2):28-29, Fall 1990.
  17.  
  18. Copyright © 1991 SPLAsh Resources. All rights reserved. This source code is
  19. copyrighted, but free. This means that programmers may use the code and
  20. incorporate it into their own programs (commercial or otherwise) without payment
  21. of any fees. However, the source code itself may not be sold or distributed on
  22. electronic bulletin board services without written permission from SPLAsh
  23. Resources.
  24.  
  25. SPLAsh Resources
  26. 1678 Shattuck Ave #302
  27. Berkeley, CA  94709
  28. (415) 527-0122
  29.  
  30. HISTORY:
  31. 2/25/91 dgp added to VideoToolbox
  32. 8/24/91    dgp    Made compatible with THINK C 5.0.
  33. 5/28/94 dgp Eliminated use of SysEqu.h, for compatibility with Apple's Universal Headers.
  34. 10/5/95 dgp converted the specification of the low-memory globals from the old nonstandard
  35.             Mac notation (e.g. Point MTemp:0x828;) to standard C. Bosco Tjan reported
  36.             that the Symantec PPC C 8 compiler won't accept the old nonstandard syntax.
  37. */
  38. #include "VideoToolbox.h"
  39.  
  40. /* Caution: if you use these defines elsewhere, you'll want to add more parentheses. */
  41. #define MTemp *(Point *)0x828
  42. #define RawMouse *(Point *)0x82C
  43. #define CrsrNew *(Byte *)0x8CE
  44. #define CrsrCouple *(Byte *)0x8CF
  45.  
  46. void SetMouse(Point    where)
  47. {
  48.  
  49.     LocalToGlobal(&where);        /* Convert point to global coordinates    */
  50.     
  51.     /* Quoting from the Q & A Stack: "If you wish to place the cursor in an    */
  52.     /* absolute location on the screen, you must set RawMouse, and MTemp to    */
  53.     /* the same value, and set CrsrNew to the same value as CrsrCouple."    */
  54.         
  55.     MTemp=RawMouse=where;
  56.     CrsrNew=CrsrCouple;
  57. }
  58.